


/*DO file created by William D. Hicks (hickswd@appstate.edu)*/

/*
                 YOU NEED TO FIRST IMPORT THE .DTA DATASET
                 THIS REQUIRES THAT YOU WRITE YOUR OWN PATH
*/

use ~[FILE PATH]/REPLICATION_DATA_LEGISLATORS_FULL.dta, clear 

/*
            OUTPUT (ALL TABLES & GRAPHS) SAVED TO ~DIRECTORY
    -you also need to set the appropriate location for a directory file - 
*/

cd [MAKE YOUR DIRECTORY HERE]



/* REQUIRES coefplot THE USER WRITTEN COMMAND*/


/* WHICH OF THE FOLLOWING REFLECTS YOUR FAMILIARITY WITH CHAPTGPT?*/
tab Q2_Familiarity
recode Q2_Familiarity (-99=.)

/*WHAT (IF ANY) IS YOUR CURRENT POLICY REGARDING CHATGPT FOR YOUR COURSE(S)?*/

tab Q3_Policy
recode Q3_Policy (-99=.)

/*HOW WOULD YOU RATE YOUR OVERALL OPINION OF CHAPTGPT'S POTENTIAL IMPACT ON THE TEACHING
   AND LEARNING EXPERIENCE IN HIGHER EDUCATION*/
 tab Q4_Opinion /* some code issues reflective of different iterations from this survey */
 recode Q4_Opinion (-99=.) (14=.) (15=.) (16=.)
 
 
 /* CONCERNS ABOUT CHEATING
 
  HOW CONCERNED ARE YOU ABOUT STUDENTS...
  1 Submitting another students work as their own?
  2 Hiring or having someone write their papers?
  
  */
  
tab Q6_Concern1
recode Q6_Concern1 (-99=.)
tab Q6_Concern2
recode Q6_Concern2 (-99=.)

alpha Q6_Concern1-Q6_Concern2, item gen(Cheating_concerns)
/* Cronbach's alpha 0.7996*/ 

sum Cheating_concerns
label var Cheating_concerns "Cheating Conern Scale (1 to 5)"

hist Cheating_concerns, color(ebblue) lcolor(edkblue) frequency ///
     xtitle("Cheating Concerns", size(small)) ///
	 ytitle("Number of observations", size(small)) ///
	 ylabel(5(5)25, labsize(small)) ///
     xlabel(1 "None at all"  2 "2" 3 "3" 4 "4" 5 "A great deal", angle(0) labsize(small)) ///
     scheme(economist) graphregion(fcolor(white) icolor(white) lcolor(white)) 
	 
sum Cheating_concerns, detail

xtile Cheating3 = Cheating_concerns, n(3)

xtile Cheating2 = Cheating_concerns, n(2)

gen concerned = 0
replace concerned =1 if Cheating2 == 2
label define concerned 0 "Average or Lower Conern" 1 "Higher than Average Concern"
label val concerned concerned

label var concerned "Concern about students cheating"


	 
/* What are you currently doing or planning to do in order to prevent cheating 
   with ChatGPT or other AI? 
1. Fewer take-home assignments & assesments 
2. Change types of questions & assesments used to test student knowledge
3. Use software that can detect AI assisted writing 
4. Use online proctoring or browser blocking software
5. Require students to write first drafts in classroom
6. Allow students to use AI tools but require them to acknowledge used
7. More handwritten assesments
8. Use more questions and assignments about recent event that are less likely to be available to chatbots*/    
 
 
recode Q7_plan1-Q7_plan8 (-99=.) (1=1) (2=1) (3=0) 
label define plan 0 "None" 1 "Already doing/planning to do"
label val Q7_plan1 plan
label val Q7_plan2 plan
label val Q7_plan3 plan
label val Q7_plan4 plan
label val Q7_plan5 plan
label val Q7_plan6 plan
label val Q7_plan7 plan
label val Q7_plan8 plan

lab var Q7_plan1 "Fewer take-home assignments & assesments" 
lab var Q7_plan2 "Change types of questions & assesments"
lab var Q7_plan3 "Use software to detect AI" 
lab var Q7_plan4 "Use proctoring or browser blocking software" 
lab var Q7_plan5 "Require students to write in classroom"
lab var Q7_plan6 "Allow students to use AI tools with acknowledgement" 
lab var Q7_plan7 "More handwritten assesments"
lab var Q7_plan8 "Use more questions about very recent events"


mean Q7_plan1-Q7_plan8, level(95)
estimates store PLANS

coefplot (PLANS, msymbol(D) mcolor(gs5) ciopts(lcolor(gs5)) pstyle(p4) offset(0)), ///  
         cismooth  ///
         scheme(s2mono) ///
		 order() ///
		 xlabel(.2(0.1).9, labsize(small)) ///
		 xtitle("Proportion Already doing/Planning to do", size(small)) ///
		 coeflabels(, labsize(vsmall)) ///
		 legend(off) ///
		 graphregion(fcolor(white) icolor(white) lcolor(white) ///
		 margin(0 2 2 2)) 
gr export FIGURE_PLANS.png, replace
gr export FIGURE_PLANS.tif, replace


recode Q12_year (-99=.)
gen junior_faculty = . 
replace junior_faculty = 1 if Q12_year == 4 | Q12_year ==5 /*FOLKS WHO HAVE TAUGHT 7 or FEWER YEARS*/
replace junior_faculty = 0 if Q12_year> 5 

mean Q7_plan1-Q7_plan8, over(Q12_year)
estimates store RANK_Plans_FULL


mean Q7_plan1-Q7_plan8 if junior_faculty==0, level(95)
estimates store Junior_Plans

mean Q7_plan1-Q7_plan8 if junior_faculty==1, level(95)
estimates store Senior_Plans


coefplot (Junior_Plans, label(Junior Faculty) msymbol(S) mcolor(gs10) ciopts(lcolor(gs10)) offset(0.05)) ///
         (Senior_Plans, label(Senior Faculty) msymbol(D) mcolor(gs5) ciopts(lcolor(gs5)) pstyle(p4) offset(-0.05)), ///  
         cismooth  levels(90) ///
         scheme(s2mono) ///
		 order() ///
		 xlabel(0(0.1)1, labsize(small)) ///
		 xtitle("Proportion Already doing/Planning to do", size(small)) ///
		 coeflabels(, labsize(vsmall)) ///
		 legend( size(small)) ///
		 graphregion(fcolor(white) icolor(white) lcolor(white) ///
		 margin(0 2 2 2)) 
gr export FIGURE_3.png, replace
gr export FIGURE_3.tif, replace


/* Significant Differences (t-tests below) for Q7_plan5 "require students to write..." 
   Q7_plan6 allow students to use...*/
   
ttest Q7_plan1, by(junior_faculty) 
ttest Q7_plan2, by(junior_faculty) 
ttest Q7_plan3, by(junior_faculty) 
ttest Q7_plan4, by(junior_faculty) 
ttest Q7_plan5, by(junior_faculty) /*p<0.1*/
ttest Q7_plan6, by(junior_faculty) /*p<0.05*/
ttest Q7_plan7, by(junior_faculty)
ttest Q7_plan8, by(junior_faculty) 

 mean Q7_plan1-Q7_plan8, over(concerned)


mean Q7_plan1-Q7_plan8 if concerned==0, level(95)
estimates store unconcerned

mean Q7_plan1-Q7_plan8 if concerned==1, level(95)
estimates store concerned


coefplot (unconcerned, label(Less Concern with Cheating) msymbol(S) mcolor(gs10) ciopts(lcolor(gs10)) offset(0.05)) ///
         (concerned, label(More Concern with Cheating) msymbol(D) mcolor(gs5) ciopts(lcolor(gs5)) pstyle(p4) offset(-0.05)), ///  
         cismooth ///
         scheme(s2mono) ///
		 order() ///
		 xlabel(0(0.1)1, labsize(small)) ///
		 xtitle("Proportion Already doing/Planning to do", size(small)) ///
		 coeflabels(, labsize(vsmall)) ///
		 legend( size(small)) ///
		 graphregion(fcolor(white) icolor(white) lcolor(white) ///
		 margin(0 2 2 2)) 
gr export FIGURE_4.png, replace
gr export FIGURE_4.tif, replace


/* Significant differences?
    Q7_plan5 "Require students to write in classroom"
	Q7_plan3 "Use software to detect AI"  */
	
ttest Q7_plan1, by(concerned) 
ttest Q7_plan2, by(concerned) 
ttest Q7_plan3, by(concerned) /*p /approx 0.14*/ 
ttest Q7_plan4, by(concerned) 
ttest Q7_plan5, by(concerned) /*p<0.05*/
ttest Q7_plan6, by(concerned) 
ttest Q7_plan7, by(concerned)
ttest Q7_plan8, by(concerned) 



/* TO WHAT EXTENT DO YOU AGREE OR DISAGREE WITH THE FOLLOWING STATEMENTS ABOUT
   CHATGPT AND SIMILAR AI
   
1. THEY WILL FUNDAMENTALLY CHANGE HIGHER EDUCATION
2. THEY PROVIDE HIGHER EDUCATION WITH AN OPPORTUNITY TO RE-ENVISION THE TEACHING 
   AND LEARNING EXPERIENCE
3. THEY REPRESENT A SIGNIFICANT THREAT TO THE TEACHING AND LEARNING EXPERIENCE*/

/* MODIFYING VARIABLES TO 1 = AGREE 0= NEUTRAL, DISAGREE, OR DON'T KNOW*/

recode Q9_change-Q9_threat (-99=.) (4=1) (3=0) (2=0) (1=0) 
label define future 0 "Neutral/Disagree" 1 "Agree"
label values Q9_change-Q9_threat future 

lab var Q9_change "ChatGPT and AI will fundamentally changer higher ed" 
lab var Q9_opportunity "ChatGPT and AI provide opportunity to re-invision T&L" 
lab var Q9_threat "ChatGPT and AI represent significant threat to T&L"

mean Q9_change-Q9_threat, level(95)
estimates store FUTURE
coefplot (FUTURE, msymbol(D) mcolor(gs5) ciopts(lcolor(gs5)) pstyle(p4) offset(0)), ///  
         cismooth  ///
         scheme(s2mono) ///
		 order() ///
		 xlabel(.1(0.1).8, labsize(small)) ///
		 xtitle("Proportion who Agree", size(small)) ///
		 coeflabels(, labsize(vsmall)) ///
		 legend(off) ///
		 graphregion(fcolor(white) icolor(white) lcolor(white) ///
		 margin(0 2 2 2)) 
gr export FIGURE_FUTURE.png, replace
gr export FIGURE_FUTURE.tif, replace



mean Q9_change-Q9_threat if concerned==0, level(95)
estimates store FUTURE_unconcerned
mean Q9_change-Q9_threat if concerned==1, level(95)
estimates store FUTURE_concerned

mean Q9_change-Q9_threat, over(Cheating3)


mean Q9_change-Q9_threat, over(Q12_year)

mean Q9_change-Q9_threat if junior_faculty==0, level(95)
estimates store Junior_FUTURE

mean Q9_change-Q9_threat if junior_faculty==1, level(95)
estimates store Senior_FUTURE


coefplot (Junior_FUTURE, label(Junior Faculty) msymbol(S) mcolor(gs10) ciopts(lcolor(gs10)) offset(0.05)) ///
         (Senior_FUTURE, label(Senior Faculty) msymbol(D) mcolor(gs5) ciopts(lcolor(gs5)) pstyle(p4) offset(-0.05)), ///  
         cismooth  ///
         scheme(s2mono) ///
		 order() ///
		 xlabel(0(0.1)1, labsize(small)) ///
		 xtitle("Proportion who Agree", size(small)) ///
		 coeflabels(, labsize(vsmall)) ///
		 legend( size(small)) ///
		 graphregion(fcolor(white) icolor(white) lcolor(white) ///
		 margin(0 2 2 2)) 
gr export FIGURE_5.png, replace
gr export FIGURE_5.tif, replace


/* TTESTS */ 
ttest Q9_change, by(junior_faculty) 
ttest Q9_opportunity, by(junior_faculty) /* p~0.15*/
ttest Q9_threat, by(junior_faculty) /*p~.12*/



coefplot (FUTURE_unconcerned, label(Less Concern w/ Cheating) msymbol(S) mcolor(gs10) ciopts(lcolor(gs10)) offset(0.05)) ///
         (FUTURE_concerned, label(More Concern w/ Cheating) msymbol(D) mcolor(gs5) ciopts(lcolor(gs5)) pstyle(p4) offset(-0.05)), ///  
         cismooth  ///
         scheme(s2mono) ///
		 order() ///
		 xlabel(0(0.1)1, labsize(small)) ///
		 xtitle("Proportion who Agree", size(small)) ///
		 coeflabels(, labsize(vsmall)) ///
		 legend( size(small)) ///
		 graphregion(fcolor(white) icolor(white) lcolor(white) ///
		 margin(1 2 2 2)) 
gr export FIGURE_6.png, replace
gr export FIGURE_6.tif, replace


ttest Q9_change, by(concerned) 
ttest Q9_opportunity, by(concerned) 
ttest Q9_threat, by(concerned) /*p<0.1*/



/* DEMOGRAPHICS OF SURVEY RESPONDENTS*/

/* YEARS TAUGHT */

recode Q12_years -99 = . 

recode Q12_years (-99=0) (4=0) (5=1) (6=2) (7=3) (8=4)
label define years 0 "0-3" 1 "4-7" 2 "8-12" 3 "13-17" 4 ">17"
label val Q12_years years 

tab Q12_years





/* Gender */

gen gender = . 
replace gender = 0 if Q13_gender == 1
replace gender = 1 if Q13_gender == 2
replace gender = 2 if Q13_gender == 5

label define gender 0 "Man" 1 "Woman" 2 "Preferred not listed"
label val gender gender 

tab gender


/* race */



gen race = . 
replace race = 0 if Q14_race == 5
replace race = 1 if Q14_race == 1
replace race = 2 if Q14_race == 3
replace race = 3 if Q14_race == 2
replace race = 4 if Q14_race == 4

label define race 0 "White" 1 "Black" 2 "Latino" 3 "Asian" 4 "MENA"
label val race race 
tab race 

/* Type of University */

gen degree = . 
replace degree = 0 if Q15_typeUniv == 1
replace degree = 1 if Q15_typeUniv == 2
replace degree = 2 if Q15_typeUniv == 3
replace degree = 3 if Q15_typeUniv == 4
label define degree 0 "Associate's" 1 "Bachelor's" 2 "Master's" 3 "Doctoral"
label val degree degree
label var degree "Highest degree granted by department?"
tab degree


gen courses = Q16_course
recode courses -99 = . 
label define courses 7 ">6"
label val courses courses 
label var courses "How many courses per semester?"
tab courses 


/* Field/Concentration */

gen area = Q17_area
recode area -99 = . 

label define area 1 "American" 2 "Comparative" 3 "IR" 4 "Gender & Politics" ///
                  5 "Race & Ethnicity" 6 "Political Philosophy" ///
				  7 "PA/Policy" 8 "Other"
label val area area
tab area


/*Demograhics of Faculty*/

hist gender, discrete color(ebblue) lcolor(edkblue) percent ///
     addl addlabopts(yvarformat(%4.1f) mlabsize(vsmall)) ///
     xtitle("Gender", size(vsmall)) ///
	 ytitle("Percent of observations", size(vsmall)) ///
	 ylabel(, labsize(vsmall)) ///
     xlabel( 0 "Man" 1 "Woman" 2 "Preference not listed", angle(0) labsize(vsmall)) ///
     scheme(economist) graphregion(fcolor(white) icolor(white) lcolor(white)) 
	 
gr export FIGURE_A1.png, replace
gr export FIGURE_A1.tif, replace


	 


hist Q12_years, discrete color(ebblue) lcolor(edkblue) percent ///
     addl addlabopts(yvarformat(%4.1f) mlabsize(vsmall)) ///
     xtitle("Years teaching", size(vsmall)) ///
	 ytitle("Percent of observations", size(vsmall)) ///
	 ylabel(, labsize(vsmall)) ///
     xlabel( 0 "0-3" 1 "4-7" 2 "8-12" 3 "13-17" 4 ">17", angle(0) labsize(vsmall)) ///
     scheme(economist) graphregion(fcolor(white) icolor(white) lcolor(white)) 
	 
gr export FIGURE_A2.png, replace
gr export FIGURE_A2.tif, replace


	 


hist race, discrete color(ebblue) lcolor(edkblue) percent ///
     addl addlabopts(yvarformat(%4.1f) mlabsize(vsmall)) ///
     xtitle("Race/Ethnicity", size(vsmall)) ///
	 ytitle("Percent of observations", size(vsmall)) ///
	 ylabel(, labsize(vsmall)) ///
     xlabel( 0 "White" 1 "Black" 2 "Latino" 3 "Asian" 4 "MENA", angle(0) labsize(vsmall)) ///
     scheme(economist) graphregion(fcolor(white) icolor(white) lcolor(white)) 
gr export FIGURE_A3.png, replace
gr export FIGURE_A3.tif, replace






/* Type of institution */

hist area, discrete color(ebblue) lcolor(edkblue) percent ///
     addl addlabopts(yvarformat(%4.1f) mlabsize(vsmall)) ///
     xtitle("Teaching Area", size(vsmall)) ///
	 ytitle("Percent of observations", size(vsmall)) ///
	 ylabel(, labsize(vsmall)) ///
     xlabel( 1 "American" 2 "Comparative" 3 "IR" 4 "Gender" 5 "Race, Ethnicity" ///
	 6 "Theory" 7 "PA/Policy" 8 "Other", angle(45) labsize(vsmall)) ///
     scheme(economist) graphregion(fcolor(white) icolor(white) lcolor(white)) 
	 
gr export FIGURE_A4.png, replace
gr export FIGURE_A4.tif, replace


	 
hist degree, discrete color(ebblue) lcolor(edkblue) percent ///
     addl addlabopts(yvarformat(%4.1f) mlabsize(vsmall)) ///
     xtitle("Highest degree", size(vsmall)) ///
	 ytitle("Percent of observations", size(vsmall)) ///
	 ylabel(, labsize(vsmall)) ///
     xlabel( 0 "Associate's" 1 "Bachelor's" 2 "Master's" 3 "Doctoral", angle(0) labsize(vsmall)) ///
     scheme(economist) graphregion(fcolor(white) icolor(white) lcolor(white))
gr export FIGURE_A5.png, replace
gr export FIGURE_A5.tif, replace



hist courses, discrete color(ebblue) lcolor(edkblue) percent ///
     addl addlabopts(yvarformat(%4.1f) mlabsize(vsmall)) ///
     xtitle("Courses per semester", size(vsmall)) ///
	 ytitle("Percent of observations", size(small)) ///
	 ylabel(, labsize(vsmall)) ///
     xlabel(0(1)8, angle(0) labsize(vsmall)) ///
     scheme(economist) graphregion(fcolor(white) icolor(white) lcolor(white)) 
gr export FIGURE_A6.png, replace
gr export FIGURE_A6.tif, replace


 
